/************
 * 实例化组件
 * Created by donkey on 2018/5/17
 ************/

import Vue from 'vue';

import uiUpload from './_uploader_comp';

const Uploader = Vue.extend(uiUpload);

export default (options) => {
    const instance = new Uploader({
        propsData: options
    });
    instance.vm = instance.$mount();
    document.body.appendChild(instance.vm.$el);
    instance.vm.$on('uploader_closed', () => {
        //点击关闭按钮后删除vue对象及dom对象
        instance.vm.$destroy()
        document.body.removeChild(instance.vm.$el)
    })
    return instance.vm;
};
